import 'package:floor/floor.dart';

class DateTimeConverter extends TypeConverter<DateTime, int> {

  @override
  DateTime decode(int databaseValue) {
    return DateTime.fromMillisecondsSinceEpoch(databaseValue);
  }

  @override
  int encode(DateTime value) {
    return value.millisecondsSinceEpoch;
  }

}

class ListIntConverter extends TypeConverter<List<int>, String> {
  @override
  List<int> decode(String databaseValue) {
    //数组元素，以“ ，”分割
    List<String> list = databaseValue.split(',');
    return list.map((e) => int.parse(e)).toList();
  }

  @override
  String encode(List<int> value) {
    //数组元素，以“ ，”分割
    return value.join(',');
  }




}
